/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package trefliq.EJB.webservice;

import java.util.List;
import javax.ejb.EJB;
import javax.ejb.Stateless;
import javax.jws.Oneway;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import trefliq.EJB.entities.Person;
import trefliq.EJB.sessionbeans.PersonSession;

/**
 *
 * @author eric
 */
//@WebService(serviceName = "PersonWebService")
@Stateless()
public class PersonWebService {
    @EJB
    private PersonSession ejbRef;// Add business logic below. (Right-click in editor and choose
    // "Insert Code > Add Web Service Operation")

    @WebMethod(operationName = "getAllPeople")
    public List<Person> getAllPeople() {
        return ejbRef.getAllPeople();
    }

    @WebMethod(operationName = "findPersonById")
    public Person findPersonById(@WebParam(name = "personId") Long personId) {
        return ejbRef.findPersonById(personId);
    }

    @WebMethod(operationName = "findPersonByLastName")
    public Person findPersonByLastName(@WebParam(name = "lname") String lname) {
        return ejbRef.findPersonByLastName(lname);
    }

    @WebMethod(operationName = "findPersonByFirstName")
    public Person findPersonByFirstName(@WebParam(name = "fname") String fname) {
        return ejbRef.findPersonByFirstName(fname);
    }

    @WebMethod(operationName = "findPersonByName")
    public Person findPersonByName(@WebParam(name = "fname") String fname, @WebParam(name = "lname") String lname) {
        return ejbRef.findPersonByName(fname, lname);
    }

    @WebMethod(operationName = "deletePerson")
    public Person deletePerson(@WebParam(name = "person") Person person) {
        return ejbRef.deletePerson(person);
    }

    @WebMethod(operationName = "editPerson")
    public Person editPerson(@WebParam(name = "person") Person person) {
        return ejbRef.editPerson(person);
    }

    @WebMethod(operationName = "createPerson")
    public Person createPerson(@WebParam(name = "person") Person person) {
        return ejbRef.createPerson(person);
    }

    @WebMethod(operationName = "deleteAll")
    @Oneway
    public void deleteAll() {
        ejbRef.deleteAll();
    }
}
